home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / exkey4.arc / EXKEY.DOC next >
Text File  |  1990-01-27  |  8KB  |  179 lines

  1.  
  2. This archive should contain the following files:
  3.  
  4.         EXTKEY.ASM - Source code for the interrupt handler
  5.         EXTKEY.OBJ - Object file of the above, ready for linking
  6.         EXKEY.PAS  - Turbo Pascal (v4.0 upwards) code for the
  7.                      ExKey Unit.
  8.         EXKEY.TPU  - Exkey Unit ready compiled (TP 5.5)
  9.         TPTEST.PAS - Source for a simple Turbo Pascal test
  10.                      program that demonstrates the unit in action.
  11.         TPTEST.EXE - Compiled version of above
  12.         EXKEY.DOC  - This file
  13.  
  14. ───────────────────────────────- NOTICE ────────────────────────────────
  15.  
  16. (C) Copyright Aubrey Scoon (Scoon Consultancy Services) 1990
  17.  
  18.     All rights reserved
  19.  
  20. This product is shareware. This means you can (and are encouraged
  21. to), copy and distribute it freely without the express permission
  22. of the author, subject to the following conditions:
  23.  
  24. 1) This product is to be distributed preferably in unaltered form together
  25.    with this document file. If you wish to make improvements to the
  26.    source code please feel free but please mark which bits are the
  27.    original code and which you have added. Please do not remove any
  28.    original credits, copyrights or acknowledgements from the
  29.    source code. This document file is NOT be altered in any way.
  30.  
  31. 2) This product is not to be sold by any party other than the
  32.    author without the express permission of the author; no money
  33.    is to be charged for its distribution, except inasmuch as a
  34.    nominal fee that may be charged for the medium of its
  35.    distribution e.g diskette.
  36.  
  37. 3) The author retains all rights of ownership and copyright and may
  38.    change, supersede or otherwise dispose of this product at his
  39.    discretion without liability to any other party.
  40.  
  41. 4) The author accepts no responsibility for loss of data or damage
  42.    to systems arising through the use or misuse of this product.
  43.  
  44. 5) If you use this product (especially if you incorporate it into
  45.    any commercial package) a small monetary donation to the
  46.    author (address below) would be appreciated. The amount is up
  47.    to you, you can pay what you think its worth to you.
  48.  
  49. ───────────────────────────────────────────────────────────────────────-
  50.  
  51. EXKEY - User Documentation
  52. ──────────────────────────
  53.  
  54. What is ExKey ?
  55. ───────────────
  56.  
  57. ExKey is an assembler patch that replaces the default INT 16
  58. keyboard handler. It provides support (via the normal INT 16
  59. functions 0,1,2) for extended style AT and PS/2 keyboards.
  60.  
  61. Why is it needed ?
  62. ─────────────────-
  63.  
  64. Many modern IBM compatible machines have "extended" IBM style 101
  65. and 102 key keyboards. Unfortunately the default keyboard handler
  66. routines in most machines were only designed to handle the old
  67. IBM PC type keyboard. This means that certain keys on the
  68. extended keyboard are unusable with many software packages,
  69. notably the F11 and F12 function keys. Many machines however DO
  70. provide extended keyboard support but ONLY through different INT
  71. 16 function calls. This means in effect that although your BIOS
  72. may actually support these extra keys you STILL wont be able to
  73. use them with your latest software product unless you write your
  74. own handler routines.
  75.  
  76. A typical example of this is Turbo Pascal. If you look at the
  77. Turbo Pascal reference manual (page 424 in version 5.5 -
  78. different page no in other versions) you will see that it lists
  79. scan codes for extended keyboards, including the codes for F11
  80. and F12. However on many machines when you try to use the F11 and
  81. F12 scan codes (codes 133 upwards) you will probably find that it
  82. doesn't work ! This isn't a problem with Turbo Pascal, its a
  83. problem with the BIOS of many machines.
  84.  
  85. ExKey gets round this problem by mapping the old keyboard
  86. routines on to the new extended routines. The result is that if
  87. you include the ExKey code in your program, you should now be
  88. able to use the extra function keys as normal i.e. they will
  89. return their scan codes as documented.
  90.  
  91. ExKey wont neccessarily work on ALL machines with an extended
  92. keyboard. ExKey tests the BIOS data area flags to see if there is
  93. an extended keyboard present. If not it will invoke the default
  94. keyboard routines (i.e. it will not make any difference). On all
  95. other machines it will attempt to invoke the enhanced keyboard
  96. handler. If it still doesn't work it means that your BIOS is
  97. incapable of handling an enhanced keyboard i.e. it does not
  98. support the INT 16h functions 10h,11h and 12h.
  99.  
  100. This routine is therefore a compromise - it should work on all
  101. machines that were supplied with an extended keyboard.
  102.  
  103. This archive contains both a Turbo Pascal Unit (with source), so
  104. you can use ExKey with Turbo Pascal, and a copy in Microsoft
  105. standard object file format for you to link into other compilers
  106. or assemblers if you wish.
  107.  
  108. Using ExKey
  109. ───────────
  110.  
  111. ExKey is very easy to use. There are no parameters needed. All
  112. you have to do is call the procedure SetKeyVector at the
  113. beginning of your program (usually in the initialisation code)
  114. and RestoreKeyVector just before leaving your program. This
  115. applies to both the Assembler version and the TP version. The
  116. rest is completely automatic. SetKeyvector redirects the INT 16
  117. interrupt to the internal routine NewKey, and RestoreKeyVector
  118. restores the default interrupt handler when you have finished.
  119. Exkey also offers an additional function called
  120. "Ext_Keyboard_Present", which detects if an extended keyboard is
  121. present or not. From Turbo Pascal simply call the function of
  122. that name and it returns a boolean flag TRUE or FALSE if an
  123. extended keyboard is present. See TPTEST for an example. From
  124. assembler you can also call this function, when it returns in
  125. the AL register the value 0 if no extended keyboard is present
  126. or the value 1 if it is. All registers other than AL are
  127. preserved.
  128.  
  129. WARNING: If you make the execution of SetKeyVector conditional
  130. upon the keyboard flag you MUST do the same with
  131. RestoreKeyVector. Otherwise if your routine tries to run
  132. SetKeyVector WITHOUT RestoreKeyVector, or vice versa it will
  133. crash the machine. It is not neccessary to make the execution of
  134. the vector routines conditional anyway as they will autodetect
  135. the presence or absence of an extended keyboard anyway and act
  136. appropriately without user intervention.
  137.  
  138. NOTE: If you call the assembler routines directly, you need to
  139. use a FAR call model.
  140.  
  141. The scan codes for the extra key functions are as follows:
  142.  
  143. ┌─────┬───────────────────┬────────────┬───────────┬──────────┐
  144. │ Key │ Normal(unshifted) │ With Shift │ With Ctrl │ With Alt │
  145. ├─────┼───────────────────┼────────────┼───────────┼──────────┤
  146. │ F11 │       133         │   135      │    137    │   139    │
  147. │ F12 │       134         │   136      │    138    │   140    │
  148. └─────┴───────────────────┴────────────┴───────────┴──────────┘
  149.  
  150. These keys also return a null (character 0) character code when
  151. pressed, like the other "normal" function keys.
  152.  
  153. If you have any questions about this product please contact me at
  154. the following address (or leave a message on the BBS below).
  155.  
  156.         Aubrey Scoon
  157.         Scoon Consultancy Services
  158.         49 Honeyhill Road,
  159.         Bracknell,
  160.         Berkshire.
  161.         RG12 1YH
  162.         U.K.
  163.  
  164. Messages may be left for me on the BBS below:
  165.  
  166. Mission Impossible (Nottingham) (0602) 654329
  167. Hawk's Castle (Bracknell) (0344) 411621
  168.  
  169. Both support 300,1200,2400 and 9600HST speeds, 8 bits, no parity,
  170. 1 stopbit, 24 hours per day.
  171.  
  172. I would like to thank Alan Guyan for pointing out a method of
  173. detecting an enhanced keyboard and his help in testing the
  174. routine, and John Franklin for his help in finding the bugs and
  175. his suggestion for a solution which is incorporated into this
  176. routine.
  177.  
  178. Aubrey Scoon.
  179.